package dao_.dao;

import dao_.domain.Goods;

import java.util.List;

/**
 * @author DCSGO
 * @version 1.0
 */
public class GoodsDAO extends BasicDAO<Goods> {
    public void showGoods() {
        List<Goods> goods = this.queryMulti("select * from goods", Goods.class);
        if (goods.isEmpty()) {
            System.out.println("no data!");
            return;
        }
        for (Goods g : goods) {
            System.out.println(g);
        }
    }

    public int insert(Goods goods) {
        return this.update("insert into goods values (?,?,?)",
                goods.getId(), goods.getGoods_name(), goods.getPrice());
    }
}
